package com.eduspace.eduplatform.wares.utils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.convert.converter.Converter;

/**
 *
 * @author tbc
 * @version 1.0 {2016年8月1日 下午3:06:34}
 */
public class NumberFormatConverter implements Converter<String, Double> {
	private Logger log = LoggerFactory.getLogger(NumberFormatConverter.class);

	@Override
	public Double convert(String source) {
		try {
			return Double.valueOf(source);
		} catch (Exception e) {
			log.error("参数绑定错误，源参数{}，类型{}无法转换为类型{}", String.class.getName(), Double.class);
			throw new RuntimeException(e);
		}
	}

}
